import requests

# r = requests.get("http://www.baidu.com")
# r = requests.get("http://www.bilibili.com")
# print(r.status_code)
# print(r.content)
# print(r.headers)
# print(r.json())
# print(r.url)
# print(r.cookies)
# print(r.raw)
# print(r.text)
# print(r.raise_for_status())

#
# get_r = requests.get("http://www.baidu.com")
# post_r = requests.post("http://www.baidu.com")
# req_r1 = requests.request(method="get", url="http://www.baidu.com")
# req_r2 = requests.request("post", "http://www.baidu.com")
#
# print(f'get:{get_r.status_code}')
# print(f'post:{post_r.status_code}')
# print(f'method_get:{req_r1.status_code}')
# print(f'method_post:{req_r2.status_code}')

"""
# 博客详情接⼝
url = "http://8.137.19.140:9090/blog/getBlogDetail"

# 定义查询参数
params = {
    "blogId": 158477
}
# 定义请求头信息
header = {
    "user_token_header": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6MSwidXNlck5hbWUiOiJ6aGFuZ3NhbiIsImV4cCI6MTc1NjIxNzk4Mn0.DDm1mHg13VAo4FaNQNND1g4MhDLMIi40ERhJpD55A3s",
    "x-requested-with": "XMLHttpRequest"
}

r = requests.post(url=url, params=params, headers=header)
print(r.json())
"""
"""
# 博客登录接口
url = "http://8.137.19.140:9090/user/login"

# 定义要发送的数据
data = {
    "username": "zhangsan",
    "password": "123456"
}

r = requests.post(url=url,data=data)
print(r.json())
"""

"""
# 添加cookie信息
def test_1():
    url = "https://home.cnblogs.com/ajax/user/GetUnreadMsgCount"

    # 定义请求头信息
    header = {
        "Accept": "application/json, text/javascript, */*; q=0.01"
    }

    #定义cookie信息
    cookie = {
        ".Cnblogs.AspNetCore.Cookies": "CfDJ8G33EJ5dWE5OhU_7yPrjq19AsVK4o34FCKvuzz-Qu2t-EWCzHk8JnhoKN4IRMduFlESypFZiNTFGvJUuYUaes5bppfTvRlPS_KRwwt7d_jeJ8OjglD8N6FZbHKc5KS4mBjYGiCuNOc1MxleItSA75t_sJPgj8gGkr9gnVklCpIe90XtZwutiFQfxBZmp7S-CYKXArSaWG3Nh6wiL-yaPP0Iv1h4Ft8nNEqBFD-H8f6lMZzLBdaz03DMEbl9bhHuZHvQPsUhX6I5pmkV4gTl2OhAaYO0akYA1ncCGRgW_CvPYXhOeNkb_LqUqzomSWEtYb6KL1lLompRhcaqsQv3uXJ56d-lkAhDWHXNZ5UbZifIphsz5ZEhDooHPcsUWHM51ScLHL4MR1Kmc_7COSZIFuHNvdTsTiUQ-DTwiapPa2p_5ASwAZCh9fyTM9bR_vCwUlE3iFwcDPq7OVJaY4radSzg_xWOdkQzbB5fTcrsQrzlGFolZLBidg6G1o1vo5gTIbnnl21UMM8iAdNcUOM_Uf7wkEtlFB3FEV3iAC2UFgq9Y_r9-Y-0gJP1ywNGZq_jRTA",
    }

    r = requests.post(url=url, headers=header, cookies=cookie)
    print(r.json())
"""

